package cn.dly.login.controller;


import cn.dly.login.entity.User;
import cn.dly.login.mapper.UserMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Hrd
 * @since 2021-07-05
 */
@RestController
@RequestMapping("/sys/test/user")
public class UserController {
    @Autowired
    UserMapper userMapper;
    @PostMapping("/getnickname")
    public String getNickname(@RequestParam("name") String name){
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",name);
        User user = userMapper.selectOne(queryWrapper);
        return user.getNickname();
    }

}

